Skip to content

Comments

Supporting file lock types#125

Merged
i2h3 merged 1 commit intomainfrom
feature/lock-types
Sep 29, 2025
Merged

Supporting file lock types#125
i2h3 merged 1 commit intomainfrom
feature/lock-types

Conversation

@i2h3
Copy link
Collaborator

@i2h3 i2h3 commented Sep 25, 2025

  • Removed unnecessary wrapper implementation and use new file locking method from NextcloudKit directly.
  • Improved logging in Item+LockFile.swift based on recently introduced logging system.
  • Introduced new key to FileProviderLogDetailKey for NKLock objects.
  • Introduced SchemaVersion enum for cleaner references to Realm schema versions.
  • Introduced lockToken property to data models representing an item.

Required for: #124
Depends on: nextcloud/NextcloudKit#190 (CI actions will fail until this is available as a 7.x.x release which is referenced as a package dependency from this project)
files_lock documentation: https://github.com/nextcloud/files_lock?tab=readme-ov-file#api

@i2h3 i2h3 requested a review from Copilot September 25, 2025 13:15
@i2h3 i2h3 self-assigned this Sep 25, 2025
@i2h3 i2h3 added the enhancement New feature or request label Sep 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes wrapper implementation for file locking and adopts the new file locking method from NextcloudKit directly. The changes support different file lock types and improve the overall lock handling mechanism.

  • Replaced old setLockStateForFile wrapper with direct usage of lockUnlockFile from NextcloudKit
  • Added new lock-related properties (lockToken, lockOwnerEditor, etc.) to data models and metadata structures
  • Introduced SchemaVersion enum for cleaner database schema version management

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
FilesDatabaseManagerTests.swift Updated schema version references to use new enum
MockRemoteItem.swift Added new lock properties and updated NKFile conversion
MockRemoteInterface.swift Replaced old lock method with new async throwing signature
TestableRemoteInterface.swift Updated interface to match new lock method signature
SendableItemMetadata.swift Added lockToken property to metadata structure
RealmItemMetadata.swift Added lockToken property to Realm object
ItemMetadata.swift Added lockToken property to protocol
FileProviderLogDetailKey.swift Added lock key for logging NKLock objects
Item+LockFile.swift Major refactor using new lock API with improved logging
RemoteInterface.swift Updated protocol signature for lock operations
NextcloudKit+RemoteInterface.swift Replaced wrapper with direct NextcloudKit call
NKFile+Extensions.swift Updated to use NKLock object properties
SchemaVersion.swift New enum for database schema version management
FilesDatabaseManager.swift Updated to use SchemaVersion enum

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@i2h3 i2h3 force-pushed the feature/lock-types branch from 98b8f5f to aa3814e Compare September 27, 2025 12:51
@i2h3
Copy link
Collaborator Author

i2h3 commented Sep 29, 2025

With NextcloudKit 7.1.5, the upstream pull request is available which should resolve this compiler error.

- Removed unnecessary wrapper implementation and use new file locking method from NextcloudKit directly.
- Improved logging in Item+LockFile.swift based on recently introduced logging system.
- Introduced new key to FileProviderLogDetailKey for NKLock objects.
- Introduced SchemaVersion enum for cleaner references to Realm schema versions.
- Introduced lockToken property to data models representing an item.

Signed-off-by: Iva Horn <iva.horn@icloud.com>
@i2h3 i2h3 force-pushed the feature/lock-types branch from aa3814e to 3298aa9 Compare September 29, 2025 11:13
@i2h3 i2h3 merged commit 37b1a3d into main Sep 29, 2025
2 checks passed
@i2h3 i2h3 deleted the feature/lock-types branch September 29, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants